cimport c_cxcore
cimport c_highgui
cimport cy_cvtypes

def cvLoadImage(filename):
    cdef c_cxcore.IplImage* img = c_highgui.cvLoadImage(filename, 1)
    cdef cy_cvtypes.IplImage pyimg = cy_cvtypes.IplImage()
    pyimg.thisptr = img    
    return pyimg
    
def cvCreateCameraCapture(device):
    cdef c_highgui.CvCapture* cap = c_highgui.cvCreateCameraCapture(device)
    cdef cy_cvtypes.CvCapture pycap = cy_cvtypes.CvCapture()
    pycap.thisptr = cap
    return pycap
    
def cvCreateFileCapture(filename):
    cdef c_highgui.CvCapture* cap = c_highgui.cvCreateFileCapture(filename)
    cdef cy_cvtypes.CvCapture pycap = cy_cvtypes.CvCapture()
    pycap.thisptr = cap
    return pycap
    
def cvGrabFrame(cy_cvtypes.CvCapture capture):
    cdef int out
    out = c_highgui.cvGrabFrame(capture.thisptr)
    return out
    
def cvRetrieveFrame(cy_cvtypes.CvCapture capture, streamIdx=0):
    cdef c_cxcore.IplImage* img = c_highgui.cvRetrieveFrame(capture.thisptr, streamIdx)
    cdef cy_cvtypes.IplImage pyimg = cy_cvtypes.IplImage(needs_free=0)
    pyimg.thisptr = img
    return pyimg
    
def cvQueryFrame(cy_cvtypes.CvCapture capture):
    cdef c_cxcore.IplImage* img = c_highgui.cvQueryFrame(capture.thisptr)
    cdef cy_cvtypes.IplImage pyimg = cy_cvtypes.IplImage(needs_free=0)
    pyimg.thisptr = img
    return pyimg
    
def cvReleaseCapture(cy_cvtypes.CvCapture capture):
    c_highgui.cvReleaseCapture(&capture.thisptr)
    
def cvGetCaptureProperty(cy_cvtypes.CvCapture capture, property_id):
    cdef double out = c_highgui.cvGetCaptureProperty(capture.thisptr, property_id)
    return out
    
def cvSetCaptureProperty(cy_cvtypes.CvCapture capture, property_id, value):
    cdef int out = c_highgui.cvSetCaptureProperty(capture.thisptr, property_id, value)
    return out    
    
def cvNamedWindow(name, flag):
    cdef int out
    out = c_highgui.cvNamedWindow(name, flag)
    return out
    
def cvShowImage(name, cy_cvtypes.CvArr image):
    c_highgui.cvShowImage(name, image.handle())
    
def cvWaitKey(delay):
    cdef int out
    out = c_highgui.cvWaitKey(delay)
    return out
    
def cvDestroyWindow(name):
    c_highgui.cvDestroyWindow(name)
    
def cvDestroyAllWindows():
    c_highgui.cvDestroyAllWindows()
    
def cvResizeWindow(name, width, height):
    c_highgui.cvResizeWindow(name, width, height)
    
def cvMoveWindow(name, x, y):
    c_highgui.cvMoveWindow(name, x, y)
    

    

    